﻿//IM全局配置
var imConfig = {
    //接口域名
    apiDomain: "https://weapp.711688.net.cn/api/",
    imgDomain: "http://static.711688.net.cn/",
    imDomain: "ws://192.168.1.162:2010",
    imgPath: {
        avater: "http://static.711688.net.cn/upload/card/source/thumb100_100/",
    },
    formatAvater: function (avater) {
        if (avater == null || trim(avater) == "") return "";
        if (avater != null && avater.indexOf("http") == 0)
            return avater;
        return this.imgPath.avater + avater;
    },
    api: {
        login: "im/login",
        sessionList: "im/sessionlist",
        msgList: "im/msglist",
        friendList: "im/friendlist",
        sendMsg: "im/sendmsg",
    }  
}

//全局的json状态码
var jsonCode = {
    success: 0,
    error: 501,
    NoData: 17,
    NotFound: 404
};

//登录信息
var loginConfig = {
    fromUid: 0,
    token: 'token',
    im_client_id: ''
};

function initDebug() {
    var href = document.location.href.toLocaleLowerCase();
    if (href.indexOf("192.168.1.") > -1 ||
        href.indexOf("localhost") > -1 ||
        href.indexOf("127.0.0.1") > -1) {
        imConfig.apiDomain = "http://192.168.1.163:8066/api/";
        imConfig.imDomain = "ws://192.168.1.162:2010";
    }
}

$(function () {
    loginConfig.fromUid = getCookies('wjk_im', 'uid');
    initDebug();
});
